package GUI;

import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;

import javax.swing.JPanel;

public class BottomPanel extends JPanel
{
	private static final long serialVersionUID = 1L;
	
	public static final int WIDTH = Applet.WIDTH;
	public static final int HEIGHT = Applet.HEIGHT/4;

	
	private final JPanel bottomPanel;
	private JPanel panel;
//	private JPanel bottomRightPanel;
//	private JPanel bottomCentrePanel;
//	private JPanel bottomLeftPanel;
//	
//	private JPanel objectPanelBottomRight;
//	private JPanel objectPanelCentre;
	
	public BottomPanel()
	{
		setSize(new Dimension(WIDTH, HEIGHT));
		this.bottomPanel = new JPanel(new BorderLayout());
		this.bottomPanel.setSize(new Dimension(WIDTH, HEIGHT));
		this.bottomPanel.setBackground(Color.green);
		
//		this.bottomRightPanel = new JPanel();
//		this.bottomRightPanel.setPreferredSize(new Dimension(GameScreen.BOTTOM_WIDTH, GameScreen.BOTTOM_HEIGHT));
//		this.bottomRightPanel.setBackground(Color.CYAN);
//		this.bottomPanel.add(bottomRightPanel, BorderLayout.EAST);
//		
//		this.bottomCentrePanel = new JPanel();
//		this.bottomCentrePanel.setPreferredSize(new Dimension(GameScreen.WIDTH - 400, GameScreen.BOTTOM_HEIGHT));
//		this.bottomCentrePanel.setBackground(Color.PINK);
//		this.bottomPanel.add(bottomCentrePanel, BorderLayout.CENTER);
//		
//		this.bottomLeftPanel = new JPanel();
//		this.bottomLeftPanel.setPreferredSize(new Dimension(200, GameScreen.BOTTOM_HEIGHT));
//		this.bottomLeftPanel.setBackground(Color.orange);
//		this.bottomPanel.add(bottomLeftPanel, BorderLayout.WEST);
		
		add(bottomPanel);
	}
	
//	public void addObjectPanelBottomRight(JPanel shipObjPanel)
//	{
//		if(shipObjPanel == null)
//			return;
//		this.objectPanelBottomRight = shipObjPanel;
//		shipObjPanel.setBackground(Color.GREEN);
//		bottomPanel.remove(bottomRightPanel);
//		bottomPanel.add(objectPanelBottomRight, BorderLayout.EAST);
//		this.validate();
//	}
//	
//	public void removeObjectPanelBottomRight()
//	{
//		if(objectPanelBottomRight == null)
//			return;
//		bottomPanel.remove(objectPanelBottomRight);
//		bottomPanel.add(bottomRightPanel, BorderLayout.EAST);
//		this.validate();
//	}
//	
//	public void addObjectPanelCentreRight(JPanel objPanel)
//	{
//		if(objPanel == null)
//			return;
//		this.objectPanelCentre = objPanel;
//		objectPanelCentre.setBackground(Color.GREEN);
//		bottomPanel.remove(objectPanelCentre);
//		bottomPanel.add(objectPanelCentre, BorderLayout.CENTER);
//		this.validate();
//	}
//	
//	public void removeObjectPanelBottomCentre()
//	{
//		if(objectPanelCentre == null)
//			return;
//		bottomPanel.remove(objectPanelCentre);
//		bottomPanel.add(bottomCentrePanel, BorderLayout.CENTER);
//		this.validate();
//	}
	
	public void replacePanel(JPanel panel)
	{
		if(panel == null)
			return;
		this.panel = panel;
		this.remove(bottomPanel);
		this.add(this.panel);
	}
	
	public void removePanels()
	{
//		this.removeObjectPanelBottomRight();
//		this.removeObjectPanelBottomCentre();
		if(this.panel != null)
		{
			this.remove(this.panel);
			this.add(bottomPanel);
		}
	}
}